

#include <stdio.h>
//#include <string.h>
#include "config.h"
#include "uart.h"
#include "adc.h"

BYTE ch = 0x02;

void main()
{

	  char * buf = "5fgrg34gg";
	  //char ccs[255];
		unsigned long int s,j;
	  UartInit();
	  InitADC();

	  SendString("\r\n");
	
	  SendString(buf);
	  
	
	while(1){
	
		//sprintf(ccs, "s=%d", ch);
	  SendString("\r\n");
		SendInt(ch); // 引脚号2
		
		s = GetADCResult(ch);
		
		SendString(" ");
		
		SendInt(s); // 原始值
		SendString(" ");
		
		j = (s * 503) / 1024;
		SendLongInt(j); // 计算后的电压 后两位为小数
		SendString("\r\n");
		
		SendInt(0x01); // 引脚号1
		
		s = GetADCResult(0x01);
		
		SendString(" ");
		
		SendInt(s); // 原始值
		SendString(" ");
		
		j = (s * 503) / 1024;
		SendLongInt(j); // 计算后的电压 后两位为小数
		
		
		SendString("\r\n");
		Delay(200);
	}
}

